<template>
    <div>
      <div v-for="item in courseList">{{getCourseInfo(item)}}</div>
    </div>
</template>
<script setup>
import { onMounted, ref } from 'vue'
const props = defineProps({ scope: { default: function () { return [] } }, tableItem: { default: function () { return [] } } })
const courseList = ref([])
onMounted(() => {
  courseList.value = props.scope.courseList
})
const statusMap = {
  1: '未审核',
  2: '已通过',
  3: '已过期',
  4: '禁用'
}

const getCourseInfo = (item) => {
  let courseName = item.courseName
  let status = statusMap[item.status]
  let dateRange = ''
  if(item.startDate && item.lineDate) {
    dateRange = '（' + (item.startDate||'') + '至' + (item.lineDate||'') + '）'
  } else {
    dateRange = item.courseName? '（暂无有效期）' : ''
  }
  let courseInfoText = courseName + dateRange + status
  return courseInfoText
}
</script>
